import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            int n = sc.nextInt();
            int tmp=0;
            int max=0;

            while (n!=0){
                if ((n&1)==1){
                    tmp++;
                    if (tmp>max){
                        max=tmp;
                    }
                } else {
                    if (tmp>max){
                        max=tmp;
                    }
                    tmp=0;
                }
                n>>=1;
            }
            System.out.println(max);
        }

    }
}
